<template>
  <div class="classify ">
    <div class="classify-box" v-for="item in ClassifyData" :key="item.id">
      <div class="classify-box-img">
        <img :src="item.img" alt="">
      </div>
      <div class="classify-box-text">
        {{ item.name }}
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState(['Classify']),
    ClassifyData() {
      // 返回前8个项目
      return this.Classify.slice(0, 12);
    },
  },
}
</script>

<style lang="less" scoped>
.classify {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 40px;
  width: 100%;
  height: 250px;
  // border: 1px solid #000;
  background-color: #f7f7f7;

  .classify-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    width: 190px;
    height: 100px;
    transition: transform 0.8s;


    .classify-box-img {
      width: 70px;
      height: 70px;

      img {
        width: 100%;
        height: 100%;
        overflow: hidden;
      }
    }

    .classify-box-text {
      margin-top: 5px;
      font-size: 15px;
    }

    &:hover {
      transform: scale(1.1);
      cursor: pointer;
      font-weight: 600;
    }
  }
}
</style>